package com.situ.util;

import java.util.Calendar;
import java.util.Random;

/**
 * 获取ID
 * @date 2020/12/8 - 20:11
 */
public class GetUUID {

    /**
     * 获取缴费单编号
     * @return
     */
    public static String GetPayNo(){
        Calendar now = Calendar.getInstance();
        String PayNo  = "JF"+getRandomNickname(10)+"-"+now.get(Calendar.YEAR)+(now.get(Calendar.MONTH) + 1)+"-"+now.get(Calendar.DAY_OF_MONTH);
        return PayNo;
    }

    public static void main(String[] args) {
        for (int i=0;1<20;i++) {
            System.out.println(GetPayNo());
        }
    }
    /**
     * java生成随机数字10位数
     * @param
     * @return
     */
    public static String getRandomNickname(int length) {
        String val = "";
        Random random = new Random();
        for (int i = 0; i < length; i++) {
            val += String.valueOf(random.nextInt(10));
        }
        return val;
    }
}
